package com.cgw.game.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.cgw.game.R;
import com.cgw.game.adapter.DemoAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;

import java.util.ArrayList;

public class WelcomeActivity extends AppCompatActivity {
    RecyclerView recyclerView;
    private String[] titles = new String[]{
            "睡眠项目小游戏",
            "睡眠顶部选择控件",
            "睡眠节律图表",
            "睡眠节律图表(旧)",
            "睡眠进度状态进度条",
            "睡眠进度状态进度条2",
            "弧形体重选择器",
            "尺子",
            "回廊轮播图",
            "南丁格尔玫瑰图",
            "折线图",
            "Lottie动画",
            "SmartRefresh",
            "答题",
            "压力状态测试",
            "机械进度条",
            "双重轴",
            "双重轴+柱状图",
            "双重轴+2折+柱状图",
            "分数渐变进度",
            "图表组合控件",
            "阴影学习",
            "摄像头测心率",
            "CameraX摄像头测心率",
            "app自身录屏",
            "SurfaceView",
            "水波浪效果",
            "商标折扣角标",
            "新版睡眠首页表盘",
            "图表加载更多"
    };
    private Class[] clazzs = new Class[]{
            MainActivity.class,
            DashboardActivity.class,
            LineChartActivity.class,
            RhyBarActivity.class,
            SleepProgressActivity.class,
            SleepStateProgressActivity.class,
            WeightActivity.class,
            RulerActivity.class,
            CycleBannerActivity.class,
            RoseLeafViewActivity.class,
            LineActivity.class,
            LottieActivity.class,
            SmartRefreshActivity.class,
            PrescriptionAnswerActivity.class,
            PressureStateActivity.class,
            LatticeProgressActivity.class,
            DoubleLineActivity.class,
            DoubleLineBarActivity.class,
            DoubleLineBar2Activity.class,
            ScoreProgressActivity.class,
            ChartAssembleActivity.class,
            ShadowActivity.class,
            CameraHeartActivity.class,
            CameraXHeartActivity.class,
            ScreenRecorderActivity.class,
            SurfaceViewActivity.class,
            WaveActivity.class,
            DiscountActivity.class,
            SleepSurfaceActivity.class,
            BarChartMoreActivity.class
    };
    private DemoAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        recyclerView = findViewById(R.id.recycler);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        ArrayList<String> data = new ArrayList<>();
        for (String title : titles) {
            data.add(title);
        }
        recyclerView.setAdapter(adapter = new DemoAdapter(data));
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(WelcomeActivity.this,clazzs[position]);
                intent.putExtra("title",titles[position]);
                startActivity(intent);
            }
        });
    }

}
